package com.hunan.api.catv.entity.enums;


public enum Channel {

    Android(1, "Android"),

    CMS(2, "CMS"),

    H5(3, "H5"),

    IOS(4, "IOS");

    private final Integer code;

    private final String value;


    Channel(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static Channel getResult(int code) {
        Channel[] rcs = Channel.values();
        for (Channel rc : rcs) {
            if (rc.getCode() == code) {
                return rc;
            }
        }
        return null;
    }

    public static String getValue(String code) {
        Channel[] rcs = Channel.values();
        for (Channel rc : rcs) {
            if (rc.getCode().toString().equals(code)) {
                return rc.getValue();
            }
        }
        return null;
    }
}
